import QtQuick
import QtQuick.Particles

Rectangle {
    width: 400
    height: 400
    color: "black"

    ParticleSystem {
        id: particleSystem
        anchors.fill: parent

        // 粒子绘制器 - 使用图片绘制粒子
        ImageParticle {
            source: "qrc:/images/star.png"
            color: "#FFFFFF"
            alpha: 0.4
        }

        // 粒子发射器
        Emitter {
            id: emitter
            system: particleSystem
            height: parent.height/4
            width: 1
            anchors.left: parent.left

            // 发射速率 (每秒粒子数)
            emitRate: 120
            // 粒子生命周期 (毫秒)
            lifeSpan: 2400
            // 粒子大小
            size: 16
            sizeVariation: 8
            // 粒子速度
            velocity: PointDirection { x: 100 ; xVariation: 50 }
            // 粒子加速度
            acceleration: PointDirection { x: 20 }
        }

        // Age {
        //     system: particleSystem
        //     advancePosition: true
        //     lifeLeft: 500
        //     once: true
        // }

        // Attractor {
        //     affectedParameter: Attractor.Position
        //     proportionalToDistance: Attractor.Linear
        //     pointX: 400
        //     pointY: 400
        //     strength: 0.3
        // }

        // Friction {
        //     factor: 0.8
        //     threshold: 10
        // }

        // Gravity {
        //     angle: 90
        //     magnitude: 100
        // }

        // Wander {
        //     yVariance: 100
        //     pace: 200
        // }

        Turbulence {
            anchors.horizontalCenter: parent.horizontalCenter
            width: 120; height: 120
            system: particleSystem
            strength: 100
        }
    }
}
